let fs = require("fs");

let stream = fs.createReadStream('example.txt');

stream.on("data",function(chunk){
    fs.writeFile("result.txt",chunk,function(error){
        console.log(error)
    })
})
stream.on("end",function(chunk){
    console.log("end")
})